package helper

import (
	"fmt"
	"github.com/slclub/go-tips"
	"github.com/slclub/go-tips/date"
	"time"
)

// 将数字 或者字符串 转换成时间
func AutoTimeStamp(d any) time.Time {
	di := tips.Any2Int64(d)
	if di > 0 {
		return time.Unix(di, 0)
	}

	return time.Unix(date.StrToTimestamp(tips.String(d)), 0)
}

func GetDateUTC() string {
	timeFormat := "2006-01-02T15:04:05Z"
	zone, _ := time.LoadLocation("UTC")
	timeStr := time.Now().In(zone).Format(timeFormat)
	fmt.Printf("\n\n getDateGMT [%v]", timeStr)
	return timeStr
}
